<?php
    session_start();
    if($_SESSION['uid']==""||$_SESSION['level']!=2){
		exit();
	}
    include('/tool/submitValidate.php');
	include('/tool/pdo.php');
	include('/class/public-data.class.php');
	include('/bll/PublicDataBLL.php');
    include('/class/student-dormitory-change.class.php');
	include('/bll/StudentDormitoryChangeBLL.php');
    
    $action = isset($_POST['action']) ? $_POST['action'] : 0;
    $data = isset($_POST['data']) ? $_POST['data'] : null;

    switch((int)$action){
        //调往空宿舍
        case 1:
            $exchangeInfo=json_decode($data);
            if(!$exchangeInfo==null){
                $StudentDormitoryChangeBLL=new StudentDormitoryChangeBLL();
                $result=$StudentDormitoryChangeBLL->exchangeStudentDormitory($exchangeInfo);
            }
        break;
        case 2:break;
        default:break;
    }

    echo json_encode($result,JSON_UNESCAPED_UNICODE);
?>